﻿<infra:LocalizedPage x:Class="Soat.HappyNet.Silverlight.Modules.Main.ViewPages.HomePage" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           xmlns:infra="clr-namespace:Soat.HappyNet.Silverlight.Infrastructure.Components;assembly=Soat.HappyNet.Silverlight.Infrastructure"
           xmlns:Regions="clr-namespace:Microsoft.Practices.Composite.Presentation.Regions;assembly=Microsoft.Practices.Composite.Presentation"
           xmlns:controls="clr-namespace:Soat.HappyNet.Silverlight.Library.Controls;assembly=Soat.HappyNet.Silverlight.Library"
           xmlns:blacklight="clr-namespace:Blacklight.Controls;assembly=Blacklight.Controls"
           xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data">
    <UserControl.Resources>
        <Style TargetType="blacklight:DragDockPanel" x:Key="DragDockPanelStyle">
            <Setter Property="Margin" Value="10" />
			<Setter Property="BorderBrush" Value="{StaticResource DefaultBorderBrush}" />
        	<Setter Property="BorderThickness" Value="1" />
            <Setter Property="Background" Value="{StaticResource DiscreteBackgroundBrush}" />
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="blacklight:DragDockPanel">
						<Grid>
                        <Border x:Name="BackgroundBorder"
								CornerRadius="6" 
								Background="{TemplateBinding Background}" 
								BorderBrush="{TemplateBinding BorderBrush}" 
								BorderThickness="{TemplateBinding BorderThickness}">
								<Border.Effect>
									<DropShadowEffect BlurRadius="10" ShadowDepth="0" Opacity="0.5"/>
								</Border.Effect>
							</Border>
							<Border
								CornerRadius="3,3,3,3" 
								BorderThickness="{TemplateBinding BorderThickness}">
								<Grid>

									<Grid.RowDefinitions>
										<RowDefinition Height="Auto" />
										<RowDefinition Height="*" />
									</Grid.RowDefinitions>
                                    
									<ContentPresenter Grid.Row="1"
										Content="{TemplateBinding Content}"
										ContentTemplate="{TemplateBinding ContentTemplate}"/>

									<Border Background="{StaticResource HeaderBackgroundBrush}" Margin="-2" Padding="3" CornerRadius="10,10,0,0">
										<Grid>
											<Border x:Name="GripBarElement"   CornerRadius="3,3,0,0" Background="#00ffffff" VerticalAlignment="Top" MinHeight="30" Cursor="Hand"
												Margin="0,0,32,0" IsHitTestVisible="{TemplateBinding DraggingEnabled}">
												<Grid>
													<Rectangle Opacity="0.5" >
														<Rectangle.Fill>
															<LinearGradientBrush EndPoint="6.58300018310547,6.08300018310547" StartPoint="2.31500005722046,1.81500005722046" 
																SpreadMethod="Repeat" MappingMode="Absolute">
																<GradientStop Color="#FFAFAFAF" Offset="0"/>
																<GradientStop Color="#00FFFFFF" Offset="1"/>
																<GradientStop Color="#00FFFFFF" Offset="0.339"/>
															</LinearGradientBrush>
														</Rectangle.Fill>
													</Rectangle>
													<ContentPresenter Content="{TemplateBinding Header}" 
														ContentTemplate="{TemplateBinding HeaderTemplate}" />

												</Grid>
											</Border>

											<ToggleButton x:Name="MaximizeToggleButton" 
												VerticalAlignment="Top" HorizontalAlignment="Right" IsChecked="{Binding IsMaximized, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
												Margin="0,5,5,0" Width="20" Height="20" Cursor="Hand">
												<ToggleButton.Template>
													<ControlTemplate TargetType="ToggleButton">
														<Border Background="#7F000000" CornerRadius="2,2,2,2">
															<VisualStateManager.VisualStateGroups>
																<VisualStateGroup x:Name="FocusStates">
																	<VisualState x:Name="Focused"/>
																	<VisualState x:Name="Unfocused"/>
																</VisualStateGroup>
																<VisualStateGroup x:Name="CommonStates">
																	<VisualState x:Name="Disabled"/>
																	<VisualState x:Name="Normal"/>
																	<VisualState x:Name="MouseOver">
																		<Storyboard>
																			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(UIElement.Opacity)">
																				<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.6"/>
																				<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0.3"/>
																			</DoubleAnimationUsingKeyFrames>
																		</Storyboard>
																	</VisualState>
																	<VisualState x:Name="Pressed">
																		<Storyboard>
																			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(UIElement.Opacity)">
																				<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.15"/>
																			</DoubleAnimationUsingKeyFrames>
																		</Storyboard>
																	</VisualState>
																</VisualStateGroup>
																<VisualStateGroup x:Name="CheckStates">
																	<VisualState x:Name="Checked">
																		<Storyboard>
																			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="checkedArrow" Storyboard.TargetProperty="(UIElement.Opacity)">
																				<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
																			</DoubleAnimationUsingKeyFrames>
																			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="uncheckedArrow" Storyboard.TargetProperty="(UIElement.Opacity)">
																				<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
																			</DoubleAnimationUsingKeyFrames>
																		</Storyboard>
																	</VisualState>
																	<VisualState x:Name="Unchecked">
																		<Storyboard/>
																	</VisualState>
																	<VisualState x:Name="Indeterminate"/>
																</VisualStateGroup>
															</VisualStateManager.VisualStateGroups>
															<Grid Height="Auto" Width="Auto">
																<Border Margin="0,0,0,0" BorderBrush="#FFFFFFFF" BorderThickness="1,1,1,1" CornerRadius="1,1,1,1" Width="16" Height="16">
																	<Grid>
																		<Path HorizontalAlignment="Right" Margin="0,1.24500000476837,1.70700001716614,5.375" x:Name="uncheckedArrow" VerticalAlignment="Stretch" Width="6.752" Stretch="Fill" Stroke="#FFFFFFFF" Data="M0.5,1.005 L6.2509999,1.005 M6.25,6.8800006 L6.25,0.5 M6.2520003,1.0880001 L0.50000024,6.8800001" />
																		<Path HorizontalAlignment="Stretch" Margin="1.45899999141693,5.74200010299683,5.78900003433228,0.878000020980835" x:Name="checkedArrow" VerticalAlignment="Stretch" Stretch="Fill" Stroke="#FFFFFFFF" Data="M0.5,1.005 L6.2509999,1.005 M6.25,6.8800006 L6.25,0.5 M6.2520003,1.0880001 L0.50000024,6.8800001" Opacity="0" RenderTransformOrigin="0.5,0.5">
																			<Path.RenderTransform>
																				<TransformGroup>
																					<ScaleTransform/>
																					<SkewTransform/>
																					<RotateTransform Angle="180"/>
																					<TranslateTransform/>
																				</TransformGroup>
																			</Path.RenderTransform>
																		</Path>
																	</Grid>
																</Border>
																<Rectangle Fill="#FFFFFFFF" RadiusX="2" RadiusY="2" Margin="1,1,1,1" Opacity="0" x:Name="rectangle"/>
															</Grid>
														</Border>
													</ControlTemplate>
												</ToggleButton.Template>
											</ToggleButton>
										</Grid>
									</Border>
								</Grid>
							</Border>
                    </Grid>
					</ControlTemplate>					
				</Setter.Value>
			</Setter>
        </Style>
    </UserControl.Resources>
    <controls:WindowContentControl Style="{StaticResource DefaultPageStyle}" 
                                   Title="{Binding Strings.PAGE_Home, Source={StaticResource LocalizedStrings}}">
        <Grid>
            <blacklight:DragDockPanelHost Margin="10">
                <blacklight:DragDockPanelHost.Items>
                <blacklight:DragDockPanel Style="{StaticResource DragDockPanelStyle}"
                                          Header="{Binding Strings.HOME_LastProducts, Source={StaticResource LocalizedStrings}}">
                        <Grid Margin="15">
                            <data:DataGrid x:Name="LastProductsDataGrid" 
                                   Style="{StaticResource DataGridStyle}"
                                   AutoGenerateColumns="False" 
                                   IsReadOnly="True">
                                <data:DataGrid.Columns>
                                    <data:DataGridTextColumn Header="Position" Binding="{Binding Position}" />
                                    <data:DataGridTextColumn Header="Nom" Binding="{Binding Name}" />
                                    <data:DataGridTextColumn Header="Description" Binding="{Binding Description}"  />
                                    <data:DataGridTextColumn Header="Prix" Binding="{Binding Price}" />
                                </data:DataGrid.Columns>
                            </data:DataGrid>
                        </Grid>
                    </blacklight:DragDockPanel>
                    <blacklight:DragDockPanel Style="{StaticResource DragDockPanelStyle}"
                                              Header="{Binding Strings.HOME_HappyUsers, Source={StaticResource LocalizedStrings}}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition Width="10" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <Image Source="../Assets/Images/Cyril.png" 
                               Stretch="Uniform"
                               VerticalAlignment="Center"
                               HorizontalAlignment="Center"/>
                            <TextBlock Text="« Je suis super content ...! »"
                                       Grid.Column="2"
                                       HorizontalAlignment="Left"
                                       VerticalAlignment="Center"
                                       Style="{StaticResource BoldLabelStyle}" />
                        </Grid>
                    </blacklight:DragDockPanel>
                    <blacklight:DragDockPanel Style="{StaticResource DragDockPanelStyle}"
                                              Header="{Binding Strings.HOME_Weather, Source={StaticResource LocalizedStrings}}">
                        <Image Source="../Assets/Images/Nuageux.png"
                               Stretch="None"
                               VerticalAlignment="Center"
                               HorizontalAlignment="Center" />
                    </blacklight:DragDockPanel>
                    <blacklight:DragDockPanel Style="{StaticResource DragDockPanelStyle}"
                                              Header="{Binding Strings.HOME_Blank, Source={StaticResource LocalizedStrings}}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="0.3*" />
                                <ColumnDefinition Width="10" />
                                <ColumnDefinition Width="0.7*"/>
                            </Grid.ColumnDefinitions>
                            
                            <Image Source="../Assets/Images/logo.png"
                                   Stretch="Uniform"
                                   VerticalAlignment="Center" />
                            
                            <Grid Grid.Column="2"
                                  VerticalAlignment="Center">
                                <RichTextBox IsReadOnly="True"
                                             Background="Transparent"
                                             BorderThickness="0">
                                    <Paragraph FontSize="12"
                                               TextAlignment="Center">
                                        Login / password : demo / demo
                                        <LineBreak/>
                                    </Paragraph>
                                    
                                    <Paragraph FontSize="16"
                                               TextAlignment="Center">
                                        Source code available on <Hyperlink TargetName="_blank" NavigateUri="http://happynet.codeplex.com">Codeplex</Hyperlink> !
                                        <LineBreak />
                                        [ <Hyperlink TargetName="_blank" NavigateUri="http://blog.soat.fr">So@t Blog</Hyperlink> ]
                                        <LineBreak />
                                        [ <Hyperlink TargetName="_blank" NavigateUri="http://silverlight.soat.fr">Silverlight Portal by So@t</Hyperlink> ]
                                    </Paragraph>
                                </RichTextBox>
                            </Grid>
                        </Grid>
                    </blacklight:DragDockPanel>
                </blacklight:DragDockPanelHost.Items>
            </blacklight:DragDockPanelHost>
        </Grid>
    </controls:WindowContentControl>
</infra:LocalizedPage>
